<?php
include "conn.php";
//获取前端传入的手机号，进行存在检测
if(isset($_POST['telnumber'])){
    $telnumber = $_POST['telnumber'];
    $result = $conn->query("select * from registry where tel='$telnumber'");
    if($result->fetch_assoc()){//存在结果，登录成功
        if(isset($_POST['pass'])){ //手机号存在，获取密码
            $pass = sha1($_POST['pass']);
            //将手机号和密码通过sql语句查询当前的数据表中是否存在。
            $result = $conn->query("select * from registry where tel='$telnumber' and password='$pass'");
            if($result->fetch_assoc()){
                //存在结果，登录成功
                echo 'success';
            }else{//登录失败
                echo 'passwordfail';
            }
        }
    }else{//登录失败
        echo 'false';
    }
}
if(isset($_POST['submit'])){
    header('location:http://10.31.155.14:81/2104_me/nike/src/index1.html');
}
